﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 接口02
{
    class Program
    {
        static void Main(string[] args)
        {
            // 定义两个类，哺乳动物类和鸟类，至少写两个特征和方法，和一个飞的接口，里面有飞的方法
            // 定义以下类企鹅、麻雀、蝙蝠、老虎

            //Bird maQue = new Sparrow();
            Sparrow sparrow = new Sparrow();
            sparrow.Fly();
        }
    }

    interface IParams
    {
        int ID { get; }
        string Name { get; set; }
    }

    /// <summary>
    /// 哺乳动物类
    /// </summary>
    class Mammal : IParams
    {
        public int ID { get; }
        public string Name { get; set; }
        
        public void Jump()
        {
            Console.WriteLine("我会跳");
        }
    }
    /// <summary>
    /// 鸟类
    /// </summary>
    class Bird
    {
        public int ID { get; set; }
        string Name { get; set; }

        public void EatChongZi()
        {
            Console.WriteLine("我们吃虫子");
        }
        public void DownEgg()
        {
            Console.WriteLine("我们会下蛋");
        }
    }

    interface IFly
    {
        void Fly();
    }
    interface IRun
    {
        void Run();
    }

    class Penguin : Bird, IRun
    {
        public void Run()
        {
            Console.WriteLine("企鹅跑");
        }
    }

    class Sparrow : Bird, IFly, IRun
    {
        public void Fly()
        {
            Console.WriteLine("麻雀飞");
        }
        public void Run()
        {
            Console.WriteLine("麻雀跑");
        }
    }

    class Bat : Mammal, IFly
    {
        public void Fly()
        {
            Console.WriteLine("蝙蝠飞");
        }
    }
    class Tigger : Mammal, IRun
    {
        public void Run()
        {
            Console.WriteLine("老虎跑");
        }
    }
}
